package com.example.Mapper;

import com.example.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserMapper {

    @Select("select * from ydy_all.user where username = #{username}")
    User getByUsername(String username);

    @Insert("insert into ydy_all.user (username, password, phone) VALUES " +
            "(#{username},#{password},#{phone})")
    void insert(User user);

    @Select("select * from ydy_all.user")
    List<User> selectAll();

    @Select("select * from ydy_all.user where id = #{id}")
    User getById(int id);
}
